﻿ <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManageGroups.aspx.cs" Inherits="Microsoft.InformationSecurity.RiskManagement.ISRMWeb.Tasks.managegroups"
    MasterPageFile="~/CISFPortal_RightMenu.Master" %>

<%@ Register Assembly="CISFAjaxExtenders" Namespace="Microsoft.InformationSecurity.CISF.Web.AjaxExtenders"
    TagPrefix="cc2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="DefaultPageContent" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">
    <br />
    <div class="progressPopup">
        <asp:UpdateProgress ID="uprProgress" runat="server" DisplayAfter="200">
            <ProgressTemplate>
                <table class="progressBar" width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td align="center" style="width: 30%">
                            <asp:Image ID="imgUpdateProgress" ImageUrl="~/Images/LineSpinner-blue.gif" runat="server" />&nbsp;
                        </td>
                        <td>
                            <asp:Label ID="lblWaitMessage" Text="Please wait while processing data..." CssClass="messageWait"
                                Font-Bold="true" runat="server"></asp:Label>
                        </td>
                    </tr>
                </table>
            </ProgressTemplate>
        </asp:UpdateProgress>
    </div>
    <table cellpadding="0" cellspacing="0" border="0" width="1020px">
        <tr>
            <td>
                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                    <tr>
                        <td align="left" valign="middle" width="40">
                            <img src="../Images/Group-32.png" alt="Manage Task Groups" />
                        </td>
                        <td valign="middle">
                            <asp:Label runat="server" ID="lblPageHeader" Text="" CssClass="labelPageheader"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <hr />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td style="text-align: right">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                <asp:UpdatePanel ID="upnlAddGroup" runat="server">
                    <ContentTemplate>
                        <asp:Label runat="server" ID="lblErrorMessage" Text="*" ForeColor="Red"></asp:Label>
                        <asp:Label ID="lblGroupName" runat="server" Text="Group Name:" CssClass="headerlabel"></asp:Label>
                        <asp:TextBox ID="txtNewGroup" runat="server" Width="250" MaxLength="100"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvGroupName" runat="server" ControlToValidate="txtNewGroup" ValidationGroup="AddNewGroup"
                          SetFocusOnError="true" ErrorMessage="Task Group Name is a required field." Display="None" />
                        <asp:ValidationSummary ID="validationSummary" runat="server" ValidationGroup="AddNewGroup"
                            ShowMessageBox="true" ShowSummary="false" DisplayMode="List" Enabled="true" />
                        &nbsp;<asp:Button ID="btnNewGroup" runat="server" Height="26px" OnClick="btnNewGroup_Click" ValidationGroup="AddNewGroup"
                            Text="Add" Width="75" />
                        <cc1:FilteredTextBoxExtender ID="fteGroup" runat="server" FilterMode="ValidChars"
                            TargetControlID="txtNewGroup" ValidChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-:()_ ">
                        </cc1:FilteredTextBoxExtender>
                        <cc1:TextBoxWatermarkExtender ID="waterMarkGroup" runat="server" TargetControlID="txtNewGroup"
                            WatermarkText="Enter group here..." WatermarkCssClass="watermark" />
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td style="text-align: right">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                <asp:UpdatePanel ID="upnlGridView" runat="server">
                    <ContentTemplate>
                        <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                            OnRowCancelingEdit="GridView1_OnRowCancelingEdit" OnRowDataBound="GridView1_OnRowDataBound"
                            OnRowDeleting="GridView1_RowDeleting" OnRowEditing="GridView1_OnRowEditing" OnRowUpdating="GridView1_OnRowUpdating"
                            OnSorting="GridView1_OnSorting" CssClass="table" EmptyDataText="No groups exist in the system.">
                            <AlternatingRowStyle CssClass="alternate" />
                            <EmptyDataRowStyle CssClass="emptyDataRowStyle" />
                            <Columns>
                                <asp:CommandField ShowEditButton="True" UpdateText="Save" ItemStyle-Width= "80" ControlStyle-Width="30" />
                                <asp:CommandField ShowDeleteButton="True" />
                                <asp:TemplateField HeaderText="Name" SortExpression="Name">
                                    <ItemTemplate>
                                        <asp:Label ID="NameLabel" runat="server" Text='<%#Microsoft.Security.Application.AntiXss.HtmlEncode(((Microsoft.InformationSecurity.RiskManagement.ISRMWeb.TasksService.Group)Container.DataItem).Name) %>' />
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="NameTextBox" runat="server" Text='<%#((Microsoft.InformationSecurity.RiskManagement.ISRMWeb.TasksService.Group)Container.DataItem).Name %>'
                                            Width="250" MaxLength="100"/>
                                    </EditItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="TaskCount" HeaderText="Associated Tasks" ReadOnly="True"
                                    SortExpression="TaskCount" />
                                <asp:BoundField DataField="LastUpdatedBy" HeaderText="Last Updated By" ReadOnly="True" />
                                <asp:TemplateField HeaderText="Last Updated" SortExpression="LastUpdatedDate" ItemStyle-Width="200">
                                    <ItemTemplate>
                                        <asp:Label ID="LastUpdatedLabel" runat="server" Text='<%#Eval("LastUpdatedDate") %>' />
                                        <cc2:UTCToLocalExtenderControl ID="UTCToLocalExtenderControl1" runat="server" TargetControlID="LastUpdatedLabel"
                                            DateTimeFormatString="d" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" Visible="False" />
                            </Columns>
                        </asp:GridView>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="btnNewGroup" EventName="Click" />
                    </Triggers>
                </asp:UpdatePanel>
                <br />
            </td>
        </tr>
    </table>
</asp:Content>
